<?php

/**
 * This is the model class for table "projectwuziku".
 *
 * The followings are the available columns in table 'projectwuziku':
 * @property string $id
 * @property string $projectId
 * @property integer $cityId
 * @property string $wuZiId
 * @property string $name
 * @property string $pinyin
 * @property string $detail
 * @property string $measure
 * @property string $price
 * @property string $number
 * @property string $wuZiKuId
 * @property string $addTime
 */
class ProjectWuZiKu extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return ProjectWuZiKu the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'ProjectWuZiKu';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('addTime', 'required'),
			array('cityId', 'numerical', 'integerOnly'=>true),
			array('projectId, wuZiId, price, number, wuZiKuId', 'length', 'max'=>12),
			array('name', 'length', 'max'=>32),
			array('pinyin', 'length', 'max'=>128),
			array('detail', 'length', 'max'=>255),
			array('measure', 'length', 'max'=>8),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, projectId, cityId, wuZiId, name, pinyin, detail, measure, price, number, wuZiKuId, addTime', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'projectId' => 'Project',
			'cityId' => 'City',
			'wuZiId' => 'Wu Zi',
			'name' => 'Name',
			'pinyin' => '拼音',
			'detail' => 'Detail',
			'measure' => 'Measure',
			'price' => 'Price',
			'number' => 'Number',
			'wuZiKuId' => 'Wu Zi Ku',
			'addTime' => 'Add Time',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('projectId',$this->projectId,true);
		$criteria->compare('cityId',$this->cityId);
		$criteria->compare('wuZiId',$this->wuZiId,true);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('pinyin',$this->name,true);
		$criteria->compare('detail',$this->detail,true);
		$criteria->compare('measure',$this->measure,true);
		$criteria->compare('price',$this->price,true);
		$criteria->compare('number',$this->number,true);
		$criteria->compare('wuZiKuId',$this->wuZiKuId,true);
		$criteria->compare('addTime',$this->addTime,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}